import { waitObject } from "../util/wait.js";

/*！
 * 把标签上移，从问题最下方移动内容上方、问题作者下方
 */
export async function moveTagsUp() {
    const [context, info, tags] = await waitObject(() => {
        const context = document.querySelector(".introduction-wrap .card-body");
        if (!context) { return; }

        const article = context.querySelector("article");
        const info = article?.previousElementSibling;
        if (!info?.classList.contains("information")) { return; }
        if (context.children[1] !== info) { return; }

        const tags = context.querySelector("article").nextElementSibling;
        if (!tags?.querySelector("a.badge-tag")) { return; }

        return [context, info, tags];
    }, 5);

    context.insertBefore(tags, info.nextElementSibling);
}
